//
//  ViewController.m
//  runtime
//
//  Created by eport on 2020/12/13.
//

#import "ViewController.h"
#import "RTTextFieldViewController.h"
#import "JsonViewController.h"
#import "SwizzlingViewController.h"
#import "AddPropertysViewController.h"
#import "ButtonViewController.h"
#import "NSObject+MD5Utils.h"
static NSString *iden = @"iden_cell";


@interface ViewController ()<UITableViewDelegate,UITableViewDataSource>

@property(nonatomic,strong)UITableView *tableView;
@property(nonatomic,copy)NSArray *dataArray;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    NSString *str1 = [NSObject MD5:@"cgac\\jinguanyd1"];
    
    NSLog(@"-------%@",str1);
    
    
    self.title = @"导航";
    
    self.dataArray = @[@"PloceHolder",@"dicToModel",@"MethodSwizzling",@"分类添加属性",@"UIButton类扩展"];
    self.tableView = [[UITableView alloc]initWithFrame:[UIScreen mainScreen].bounds];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    [self.view addSubview:self.tableView];
    
    // Do any additional setup after loading the view.
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return self.dataArray.count;
    
}



- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    if (cell == nil) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:iden];

    }
    cell.textLabel.text = self.dataArray[indexPath.row];
    return cell;
    
    
    
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    //self.dataArray = @[@"PloceHolder",@"dicToModel"]; 分类添加属性
    
    NSString *text = self.dataArray[indexPath.row];
    
    if ([text isEqualToString:@"PloceHolder"])
    {
        
        RTTextFieldViewController *rt = [[RTTextFieldViewController alloc]init];
        [self.navigationController pushViewController:rt animated:YES];
        
    }
    else if([text isEqualToString:@"dicToModel"])
    {
      
        JsonViewController *rt = [[JsonViewController alloc]init];
        [self.navigationController pushViewController:rt animated:YES];
        
    }else if([text isEqualToString:@"MethodSwizzling"]){
      
        
        SwizzlingViewController *rt = [[SwizzlingViewController alloc]init];
        [self.navigationController pushViewController:rt animated:YES];
        
        
    }else if([text isEqualToString:@"分类添加属性"]){
        
    
        AddPropertysViewController *rt = [[AddPropertysViewController alloc]init];
        [self.navigationController pushViewController:rt animated:YES];
        
        
    }else if([text isEqualToString:@"UIButton类扩展"]){
        
        
        ButtonViewController *rt = [[ButtonViewController alloc]init];
        [self.navigationController pushViewController:rt animated:YES];
        
        
    }
    
    
}





@end
